package com.naiterui.ehp.bs.doctor.fegin;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.naiterui.ehp.bp.bo.patient.FamilyBO;
import com.naiterui.ehp.bp.bo.patient.MsgMaPublishParamBO;
import com.naiterui.ehp.bp.bo.patient.MsgPublishBO;
import com.naiterui.ehp.bp.bo.patient.MsgPublishParamBO;
import com.naiterui.ehp.bp.bo.patient.PatientInquirerBO;
import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.doctor.vo.DoctorMineVO;
import com.naiterui.ehp.bs.doctor.vo.patient.InquirerRelationVO;

/**
 * @author gaoliangliang
 * @date 2019-06-24 14:57
 * @since 1.0.0
 */
@FeignClient(name = "adAp", url = "${ehp.domain.ap}", configuration = FeignConfiguration.class)
public interface PatientFeignClient {

    int PATIENT_PUSH_PLATFORMID = 2;
    int PATIENT_PUSH_TEMPLATED_RECOMMEND_NOT_ORDER = 5;
    int PATIENT_PUSH_TEMPLATED_SESSION_FINISH = 6;

    @Async
    @RequestMapping("inner/push")
    void patientPush(@RequestParam("platformId") Integer platformId,
                     @RequestParam("templateId") Integer templateId,
                     @RequestParam("paramData") String paramDate);

    @PostMapping("inner/family/list")
    List<FamilyBO> findFamilys(List<Long> familyIds) throws BusinessException;

    /**
     * 发送消息
     * @param publishParamBO
     * @throws BusinessException
     */
    @Async
    @RequestMapping("inner/message/publish")
    void publishMessage(@RequestBody MsgPublishParamBO publishParamBO);

    /**
     * 小程序消息
     * 
     * @param publishParamBO
     * @return
     */
    @PostMapping("/inner/message/ma/publish")
    MsgPublishBO publishMaMessage(@RequestBody MsgMaPublishParamBO publishParamBO);

    /**
     * 会话评价回复消息
     */
    @Async
    @PostMapping("inner/consult/comment/reply")
    void consultCommentReply(@RequestParam("patientId") Long patientId, @RequestParam("msg") String msg) throws BusinessException;

    /**
     * 根据id获取就诊人列表
     */
    @PostMapping("inner/patient/inquirer/list")
    List<PatientInquirerBO> patientInquirerList(@RequestBody List<Long> inquirerIds) throws BusinessException;

    /**
     * 患者全量诊人列表
     */
    @PostMapping("inner/patient/inquirer/list/{patientId}")
    List<PatientInquirerBO> patientInquirerListByPatientId(@PathVariable Long patientId) throws BusinessException;

    /**
     * 就诊人与患者关系列表
     */
    @PostMapping("inner/patient/inquirer/relation/{patientId}")
    List<InquirerRelationVO> patientInquirerRelationList(@PathVariable Long patientId) throws BusinessException;

    /**
     * 获取医生主页信息
     * @param doctorId
     * @return
     */
    @PostMapping("/inner/personal/doctor/mineInfo")
    DoctorMineVO getDoctorDetailInfo(@RequestParam("doctorId") Long doctorId);

    /**
     * 患者全量诊人列表
     */
    @PostMapping("inner/patient/inquirer/default/{patientId}")
    PatientInquirerBO getDefultInquirerInfoByPatientId(@PathVariable Long patientId, @RequestParam(value = "doctorId", required = false) Long doctorId);

    /**
     * 根据就诊人Id查询就诊人信息
     */
    @GetMapping("inner/patient/inquirer//{inquirerId}")
    PatientInquirerBO getInquirerInfoById(@PathVariable Long inquirerId);
}
